package com.hitqz.robot.arm.type;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 机器人运行状态
 *
 * @author kehanjiang
 * @date 2023/09/15
 */
public enum OperateStateEnums {
    IDLE(0, "机器人静止"),
    JOG(1, "JOG状态(未运动)"),
    RTCONTROLLING(2, "实时模式控制中"),
    DRAG(3, "拖动已开启"),
    RLPROGRAM(4, "RL工程运行中"),
    DEMO(5, "DEMO演示中"),
    DYNAMICIDENTIFY(6, "动力学辨识中"),
    FRICTIONIDENTIFY(7, "摩擦力辨识中"),
    LOADIDENTIFY(8, "负载辨识中"),
    MOVING(9, "机器人运动中"),
    JOGGING(10, "JOG运动中"),
    UNKNOWN(-1, "未知"),
    ;

    private Integer code;

    private String desc;

    OperateStateEnums(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    private static final Map<Integer, OperateStateEnums> MAP = Stream.of(OperateStateEnums.values()).collect(Collectors.toMap(OperateStateEnums::getCode, v -> v));

    public static OperateStateEnums getByCode(Integer code) {
        return MAP.get(code);
    }
}
